package com.bk.action;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bk.base.BaseServlet;
import com.bk.model.Category;
import com.google.gson.Gson;


public class CategoryServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
       
  
    public CategoryServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

/**
 * ajax初始化商品类目
* @author: 千锋讲师张增强
* @createTime: 2017年7月4日 上午11:13:45
* @history:
* @param request
* @param response
* @throws ServletException
* @throws IOException void
 * @throws SQLException 
 */
	protected void initCategory(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException {
		response.setContentType("text/json;charset=utf-8");
		//调用service查询商品；类目
		List<Category>list=categoryServiceImpl.findAllCategory();
		
		Gson gson=new  Gson();
		response.getWriter().write(gson.toJson(list));
		
		
	}




}
